import {FormProps, FormSchema} from '/@/components/Table';
import {BasicColumn} from '/@/components/Table/src/types/table';
import {fetchSelectDsList} from "/@/api/development/generatorApi";


//表格显示列
export function getBasicColumns(): BasicColumn[] {
  // @ts-ignore
  return [

    {
      title: '表名称',
      dataIndex: 'tableName',
      width: 150,

    },
    {
      title: '表注释',
      dataIndex: 'tableComment',
      width: 100,
    },
    {
      title: '表编码',
      dataIndex: 'tableCollation',
      width: 100,
    },
    {
      title: '索引',
      dataIndex: 'engine',
      width: 150,
    },
    {
      title: '创建时间',
      dataIndex: 'createTime',
      width: 150,
    }
  ];
}

export function getFormConfig(): Partial<FormProps> {
  return {
    labelWidth: 150,
    baseColProps: {lg: 6, md: 24},
    schemas: formParamSchema,
  };
}


//查询条件表单
export const formParamSchema: FormSchema[] = [
  {
    label: '数据源',
    field: 'dsName',
    component: 'ApiSelect',
    componentProps: {
      api: fetchSelectDsList,
      labelField: 'name',
      valueField: 'name',
    },
    required: true,
  },
  {
    field: 'tableName',
    label: '表名称',
    component: 'Input',
  },

];


